// vuex是维护数据的 这个模块是维护 路由规则数组的数据的
import { constantRoutes } from '@/router'
export default {
  state() {
    return {
      routes: constantRoutes
      // backRoutes: [...constantRoutes]
    }
  },
  mutations: {
    setRoutes(state, filterRoutes) {
      // console.log(filterRoutes)
      // state.routes.push(...filterRoutes) // push方法会修改原数组
      state.routes = [...constantRoutes, ...filterRoutes]
    },
    resetRoutes(state) {
      console.log(constantRoutes) // 3
      state.routes = constantRoutes
    }

  },
  actions: {},
  namespaced: true
}
